﻿using Omabar.BLL;
using Omabar.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Omabar.CMS.Pages
{
    public partial class AboutMe : System.Web.UI.Page
    {
        protected List<THEME> themes;
        protected List<ROUTE> jpRoutes;
        protected List<ROUTE> hotRoutes;
        protected List<ROUTE> routes;
        protected List<COUNTRY> countrys;
        protected List<ROUTE_COUNTRY> routeCountrys;
        protected Route_Theme_BLL routeThemeBLL = new Route_Theme_BLL();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string key = Request["key"];
                string value = Request["id"];

                Theme_BLL themeBLL = new Theme_BLL();
                themes = themeBLL.GetModels("select THEME_ID,THEME_NAME,THEME_DES from THEME");
                if (themes == null) themes = new List<THEME>();

                Route_BLL routeBLL = new Route_BLL();
                routes = routeBLL.GetModels("select  ROUTE_ID,ROUTE_NAME,ROUTE_DES,ROUTE_CHENGDU,ROUTE_BEIJING,ROUTE_ELSECITY,ROUTE_CHARACTERISTIC,ROUTE_DAYS,ROUTE_PRICE,ROUTE_DATE_START,ROUTE_DATE_END,ROUTE_HOT,ROUTE_BAK,ROUTE_ELABORATE,ROUTE_ORIGINAL from ROUTE ORDER BY ROUTE_HOT DESC");
                if (routes == null) routes = new List<ROUTE>();

                hotRoutes = routes.FindAll(r => r.ROUTE_HOT >= 90);
                if (hotRoutes == null) hotRoutes = new List<ROUTE>();

                jpRoutes = routes.FindAll(r => r.ROUTE_ELABORATE > 0);
                if (jpRoutes == null) jpRoutes = new List<ROUTE>();

                CityBelong_BLL cityBelongBLL = new CityBelong_BLL();
                routeCountrys = cityBelongBLL.GetModels("select ROUTE_ID,ROUTE_CONTINENT,ROUTE_COUNTRY_NAME,ROUTE_CITY from ROUTE_COUNTRY");
                if (routeCountrys == null) routeCountrys = new List<ROUTE_COUNTRY>();

                Country_BLL countryBLL = new Country_BLL();
                countrys = countryBLL.GetModels("select COUNTRY_ID,COUNTRY_NAME,BELONG from COUNTRY");
                if (countrys == null) countrys = new List<COUNTRY>();
            }
        }
    }
}